#include<bits/stdc++.h>
using namespace std;
int f(int num)
{
    if (num<=3) 
	{
        return num>1;
    }
    if (num%6!=1&&num%6!=5) 
	{
        return 0;
    }
    int n=(int)sqrt((double)num);
    for (int i=5;i<=n;i+=6) 
	{
        if (num%i==0||num%(i+2)==0) 
		{
            return 0;
        }
    }
    return 1;
}
int main()
{
	int S;
	scanf("%d",&S);
	int n=S/2;
	int m=n+S%2;
	while(n&&m)
	{
		if(f(n)&&f(m))
		{
			printf("%d\n",n*m);
			return 0;
		}
		n--;
		m++;
	}
	return 0;
}